package cn.riacode.flurry.ui
{
    import cn.riacode.flurry.core.BorderRegion;
    import cn.riacode.flurry.core.IBorder;
    import cn.riacode.flurry.core.UIAsset;

    import flash.display.Graphics;

    /**
     * 方块UI,用作可视化组件的背景
     * @author vivi
     *
     */
    public class RoundRect extends UIAsset implements IBorder
    {

        public function RoundRect()
        {
            init();
        }

        protected function init():void
        {
            draw(graphics);
        }

        public function borderRegion():BorderRegion
        {
            return new BorderRegion(1, 1, 1, 1);
        }

        /**
         * 绘出主要背景
         * @param graphics
         *
         */
        override public function draw(graphics:Graphics):void
        {
            super.draw(graphics);

            graphics.beginFill(0xff0000);
            graphics.drawRoundRect(0, 0, 20, 20, 4, 4);
            graphics.endFill();

        }
    }
}